﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "IControlDefinitionFactory.h"
#include "GcmpGUiBaseImpl.h"

namespace gcmp 
{
    class ControlDefinitionLibrary;

    class GCMP_GUI_BASE_IMPL_EXPORT ControlDefinitionFactory : public IControlDefinitionFactory
    {
        CANNOT_COPY_OR_ASSIGN(ControlDefinitionFactory);
    public:
        ControlDefinitionFactory();
        virtual ~ControlDefinitionFactory();
       
    public:
        virtual OwnerPtr<IGalleryDefinition> CreateGallery(const std::wstring& id, const std::wstring& caption, int columnCount = 4, int itemWidth = 16, int itemHeight = 16) override;

        virtual OwnerPtr<IGalleryDefinition> CreateGalleryReference(const IGalleryDefinition* pGalleryDefinition) override;
        
        virtual OwnerPtr<ICommandButtonMenuDefinition> CreateCommandButtonMenu(const std::wstring& id, const std::wstring& commandId, const std::wstring& caption, const std::wstring& iconPath, const std::wstring& tooltip) override;

        virtual OwnerPtr<ICommandButtonMenuDefinition> CreateCommandButtonMenuReference(const ICommandButtonMenuDefinition* pCommandButtonMenuDefinition) override;
        
        virtual OwnerPtr<ICommandMenuItemDefinition> CreateCommandMenuItem(const std::wstring& id, const std::wstring& commandId, const std::wstring& caption, const std::wstring& tooltip, const std::wstring& iconPath) override;

        virtual OwnerPtr<ICommandMenuItemDefinition> CreateCommandMenuItemReference(const ICommandMenuItemDefinition* pCommandMenuItemDefinition) override;

        virtual OwnerPtr<ILineEditDefinition> CreateLineEdit(const std::wstring& id, const std::wstring& caption, LineEditInputType inputType) override;

        virtual OwnerPtr<ILineEditDefinition> CreateLineEdit(const std::wstring& id, const std::wstring& caption, double value, int decimals) override;

        virtual OwnerPtr<ILineEditDefinition> CreateLineEditReference(const ILineEditDefinition* pLineEditDefinition) override;

        virtual OwnerPtr<IRadioButtonGroupDefinition> CreateRadioButtonGroup(const std::wstring& id, const std::wstring& caption) override;

        virtual OwnerPtr<IRadioButtonGroupDefinition> CreateRadioButtonGroupReference(const IRadioButtonGroupDefinition* pRadioButtonGroupDefinition) override;

        virtual OwnerPtr<ICheckBoxGroupDefinition> CreateCheckBoxGroup(const std::wstring& id, const std::wstring& caption) override;
       
        virtual OwnerPtr<ICheckBoxGroupDefinition> CreateCheckBoxGroupReference(const ICheckBoxGroupDefinition* pCheckBoxGroupDefinition) override;

        virtual OwnerPtr<IComboBoxDefinition> CreateComboBox(const std::wstring& id, const std::wstring& caption) override;
        
        virtual OwnerPtr<IComboBoxDefinition> CreateComboBoxReference(const IComboBoxDefinition* pComboBoxDefinition) override;

        virtual OwnerPtr<ICommandButtonDefinition> CreateCommandButton(const std::wstring& id, const std::wstring& caption, const std::wstring& tooltip, const std::wstring& commandId, const std::wstring& iconPath, ButtonStyle buttonStyle) override;
    
        virtual OwnerPtr<ICommandButtonDefinition> CreateCommandButtonReference(const ICommandButtonDefinition* pCommandButtonDefinition) override;
        
        virtual OwnerPtr<ILabelDefinition> CreateLabel(const std::wstring& id, const std::wstring& caption, const std::wstring& tooltip) override;

        virtual OwnerPtr<ILabelDefinition> CreateLabelReference(const ILabelDefinition* pLabelDefinition) override;
        
        virtual OwnerPtr<IProgressBarDefinition> CreateProgressBar(const std::wstring& id, const std::wstring& caption, const std::wstring& tooltip, int length) override;

        virtual OwnerPtr<IProgressBarDefinition> CreateProgressBarReference(const IProgressBarDefinition* pProgressBarDefinition) override;

        virtual OwnerPtr<IMenuItemContainerDefinition> CreateMenuItemContainer(const std::wstring& id, const std::wstring& caption) override;

        virtual OwnerPtr<IMenuItemDefinition> CreateSeparator() override;

        virtual OwnerPtr<IMenuItemContainerDefinition> CreateMenuItemContainerReference(const IMenuItemContainerDefinition* pMenuItemContainerDefinition) override;

        virtual IUiManager* GetUiManager() override;

        virtual bool IsReference(const IControlDefinition*  pControlDefinition) override;

    private:
        inline ControlDefinitionLibrary* GetControlDefinitionLibrary() const;
    };

}// namespace gcmp

